import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IconComponent } from './icon.component';
import { ICONS_DEFINE, ICONS_DEFINE_NOT_SHOW } from './icons.define';

export function loadIcon(): void {
  // 微服务下会调用多次，导致页面会有多个live_icons资源
  const dom = document?.querySelector('#live_icons');
  if (dom) {
    return;
  }
  const icon = ICONS_DEFINE + ICONS_DEFINE_NOT_SHOW;
  document.body.insertAdjacentHTML('afterbegin', icon);
}

@NgModule({
  declarations: [IconComponent],
  imports: [CommonModule],
  exports: [IconComponent],
})
export class IconModule {}
